import { ref } from 'vue'
import { defineStore } from 'pinia'

export const usePurchaserStore = defineStore(
  'purchaser',
  () => {
    const supplier = ref('')
    const order = ref('')
    const token = ref('')

    const reset = () => {
      supplier.value = ''
      order.value = ''
      token.value = ''
    }
    const setToken = (itoken) => {
      token.value = itoken
    }
    const setSupplier = (isupplier) => {
      supplier.value = isupplier
    }
    const setOrder = (iorder) => {
      order.value = iorder
    }
    return {
      supplier,
      order,
      reset,
      setSupplier,
      setOrder,
      token,
      setToken
    }
  },
  {
    persist: true
  }
)
